package com.jiawei.栈;

/**
 * @author : willian fu
 * @version : 1.0
 */
public class Test {
    public static void main(String[] args) {
        Stack<Integer> arrayStack = new ArrayStack<>(5);
        testStack(arrayStack);
        Stack<Integer> linkedListStack = new LinkedListStack<>();
        testStack(linkedListStack);
    }

    public static void testStack(Stack stack){
        System.out.println("-----------入栈-----------");
        for (int i = 0; i < 8; i++) {
            stack.push(i);
        }
        stack.print();
        System.out.println("-----------出栈-----------");
        for (int i = 0; i < 8; i++) {
            System.out.println(stack.pop());
        }
        stack.print();
    }
}
